using System;
using System.IO.Packaging;
using System.Runtime.Serialization;

namespace OWA.Activities
{
    [global::System.Serializable]
    public class SignatureVerificationException 
        : OWAException, ISerializable
    {
        static readonly string _defaultMessage =
            "The signature verification failed with error code {0}";
        
        VerifyResult _verifyResult;
        
        public SignatureVerificationException(VerifyResult result) 
            : base(String.Format(_defaultMessage, result))
        {
            _verifyResult = result;
        }
        
        protected SignatureVerificationException(
            SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _verifyResult = (VerifyResult)info.GetValue(
                "VerifyResult", typeof(VerifyResult));
        }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("VerifyResult", _verifyResult);
            base.GetObjectData(info, context);
        }
    }
}
